<?php

class dashboardActions extends sfActions {

    public function executeIndex(sfWebRequest $request){
        $current_user = $this->getUser()->getAttribute('current_user');
        $google_profile = "";
        $facebook_profile = "";
        $twitter_profile = "";
        $user = null;

        $user = UserPeer::retrieveByPK($current_user->getId());

        $myLib = new myLib();
        $hybridauth = new Hybrid_Auth($myLib->getHybridAuthConfig());

        //Google
        if($this->getUser()->hasCredential("Google")){
            $google_profile = $myLib->hybridauthGetUserProfile("Google");
        }

        //Facebook
        if($hybridauth->isConnectedWith("Facebook")){
            $facebook_profile = $myLib->hybridauthGetUserProfile("Facebook");
        }

        //Twitter
        if($hybridauth->isConnectedWith("Twitter")){
            $twitter_profile = $myLib->hybridauthGetUserProfile("Twitter");
        }

        $this->user = $user;
        $this->hybridauth = $hybridauth;
        $this->google_profile = $google_profile;
        $this->facebook_profile =$facebook_profile;
        $this->twitter_profile =$twitter_profile;
    }

}